<template>
	<div class="form-adapt-container layout-pd">
		<el-card shadow="hover" header="订单表新增">
			<el-form :model="state" size="default" label-width="100px" class="mt35 mb35">
				<el-row :gutter="35">
			
					<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
						<el-form-item label="订单号">
							<el-input v-model="state.form.packing_list.order_code" placeholder="订单号" clearable></el-input>
						</el-form-item>
					</el-col>
					
					<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
						<el-form-item label="制单人">
							<el-input v-model="state.form.packing_list.user_name" placeholder="制单人" clearable></el-input>
						</el-form-item>
					</el-col>
					
					<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
						<el-form-item label="制单时间">
							<el-input v-model="state.form.packing_list.packing_date" placeholder="制单时间" clearable></el-input>
						</el-form-item>
					</el-col>
					
					<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
						<el-form-item label="项目号">
							<el-input v-model="state.form.packing_list.project_code" placeholder="项目号" clearable></el-input>
						</el-form-item>
					</el-col>
					
					<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
						<el-form-item label="发货时间">
							<el-input v-model="state.form.packing_list.delivery_date" placeholder="发货时间" clearable></el-input>
						</el-form-item>
					</el-col>
					
					<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
						<el-form-item label="发货地址">
							<el-input v-model="state.form.packing_list.ship_address" placeholder="发货地址" clearable></el-input>
						</el-form-item>
					</el-col>
					
					<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
						<el-form-item label="包装方式">
							<el-input v-model="state.form.packing_list.manner_of_packing" placeholder="包装方式" clearable></el-input>
						</el-form-item>
					</el-col>
					
					<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
						<el-form-item label="套包包装格式">
							<el-input v-model="state.form.packing_list.manner_type" placeholder="套包包装格式" clearable></el-input>
						</el-form-item>
					</el-col>
					
					
					<el-col :span="24" v-for="packson in state.form.packing_list_son">
					   {{packson}}
					</el-col>
					
<!-- 					<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
						<el-form-item label="职务">
							<el-select v-model="state.form.occupation" placeholder="请选择职务" clearable class="w100">
								<el-option label="计算机 / 互联网 / 通信" value="1"></el-option>
								<el-option label="生产 / 工艺 / 制造" value="2"></el-option>
								<el-option label="医疗 / 护理 / 制药" value="3"></el-option>
							</el-select>
						</el-form-item>
					</el-col> -->


					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
						<el-form-item>
							<el-button type="primary" @click="add_packing()">
								<SvgIcon name="iconfont icon-biaodan" />
								更新个人信息
							</el-button>
						</el-form-item>
					</el-col>

				</el-row>
			</el-form>
		</el-card>
		
	</div>
</template>

<script setup>
import { reactive } from 'vue';
import api from '/@/api/sy/apiERP.js';

// 定义变量内容
const state = reactive({
	form: {
  "packing_list": {
    "order_code": "order_code",
    "user_name": "制单人",
    "packing_date": "2023-09-01T12:00:00",
    "project_code": "2LN",
    "delivery_date": "2023-09-01T12:00:00",
    "ship_address": "发货地址",
    "manner_of_packing": "包装方式C",
    "manner_type": "套包包装格式"
  },
  "packing_list_son": [
    {
      "goods_code": "L002275306",
      "goods_name": "零件名称",
      "shipped_number": 9999,
      "remark": "描述"
    },
		{
		  "goods_code": "L002275293",
		  "goods_name": "零件名称2",
		  "shipped_number": 2,
		  "remark": "描述2"
		},
		{
		  "goods_code": "L002275303",
		  "goods_name": "零件名称2",
		  "shipped_number": 3,
		  "remark": "描述2"
		}
  ]
}
})

function add_packing(){
	
	var param={
		'packing_list':state.form.packing_list,
		'packing_list_son':state.form.packing_list_son
	}
	// console.log((formData))
	api.post("add_packing/",param).then(response => {
				console.log(response.data)
				//console.log(response.data);
				// 处理服务器返回的响应
			})
			.catch(error => {
				//console.log(error);
				// 处理错误
			})
			.finally(()=>{
				console.log('必须执行')
			})
			

}

			
</script>

<style scoped></style>